package spring.exceptcion;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author ZH
 */
@RestControllerAdvice
public class ExceptionHandlerController {
    @ExceptionHandler(Exception.class)
    public String customException(Exception ex){
        ex.printStackTrace();
        return "服务器发生异常 + "+ex.getLocalizedMessage();
    }
}
